package service.impl;

import dao.ScMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.Sc;
import service.ScService;

import java.util.List;

/**
 * 收藏表业务逻辑实现类
 */
@Service
public class ScServiceImpl implements ScService {
    @Autowired
    private ScMapper scMapper;

    @Override
    public Sc find_by_id(Integer id) {
        return scMapper.find_by_id(id);
    }

    @Override
    public List<Sc> find_by_user_id(Integer yh_id) {
        return scMapper.find_by_user_id(yh_id);
    }

    @Override
    public int count_by_wz_id(Integer wz_id) {
        return scMapper.count_by_wz_id(wz_id);
    }

    @Override
    public int add(Sc sc) {
        // 自动填充当前时间
        sc.setCreateTime(java.time.LocalDateTime.now());
        return scMapper.add(sc);
    }

    @Override
    public int delete_by_id(Integer id) {
        return scMapper.delete_by_id(id);
    }

    @Override
    public int delete_by_user_and_wz(Integer yh_id, Integer wz_id) {
        return scMapper.delete_by_user_and_wz(yh_id, wz_id);
    }
}